package com.itheima.app.controller.pmsController;


import com.itheima.app.manager.pmsManager.PmsSkuStockManager;
import com.itheima.commons.R;
import com.itheima.domain.db.pms.PmsSkuStock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class PmsSkuStockController {

    @Autowired
    PmsSkuStockManager pmsSkuStockManager;

    //批量更新sku库存信息
    @PostMapping("/sku/update/{pid}")
    public R updateByIdList(@PathVariable Integer pid,@RequestBody PmsSkuStock [] pmsSkuStock){

        return pmsSkuStockManager.updateByIdList(pid,pmsSkuStock);
    }

    //根据商品ID及sku编码模糊搜索sku库存
    @GetMapping("/sku/{pid}")
    public R selectByIdSku(@PathVariable Integer pid,String keyword){
        return pmsSkuStockManager.selectByIdSku(pid,keyword);
    }

}
